"""
数据库异常处理：
try：
    捕获异常的语句块
    con = pymysql.connect()
except exceptionType e:
    异常处理-- 友好的提示

finally:
    有没有异常都会执行
    con。close()

"""


# import pymysql
# from pymysql.err import OperationalError
#
# con = None
# try:
#     con = pymysql.connect(
#         host='localhost',
#         user='root',
#         password='123456',
#         port=3306,
#     )
#     con.select_db('db_qiku')
#     print(con)
# except OperationalError as e:
#     print(e)
#
# finally:
#     if con != None:
#         con.close()
